package org.xhy.hrm.client;

import feign.hystrix.FallbackFactory;
import org.springframework.stereotype.Component;
import org.xhy.hrm.domain.LoginUser;
import lombok.extern.slf4j.Slf4j;
import org.xhy.hrm.util.AjaxResult;

@Component
@Slf4j
public class LoginUserClientFallbackFactory implements FallbackFactory<LoginUserClient> {
    @Override
    public LoginUserClient create(Throwable cause) {
        return new LoginUserClient() {
            @Override
            public AjaxResult addOrUpdate(LoginUser loginUser) {
                log.error("失败失败失败！");
                return AjaxResult.me().setSuccess(false).setMessage("熔断降级了！");
            }
        };
    }
}
